var ediApp = angular.module('ediApp', [
	'ngRoute',
        'datatables',
	'ediControllers',
        'angular-md5'
]);

ediApp.config(function($routeProvider) {
    $routeProvider.
      when('/login', {
        templateUrl: 'resources/templates/loginTemp.html',
        controller: 'LoginCtrl',
		resolve: {
                     permission: function(AuthService, $location) {
                         if(AuthService.isAuthenticated()){
							$location.path('/table/1');
						 }
                     },
                 }
      }).
      when('/table/:catID', {
        templateUrl: 'resources/templates/mainTemp.html',
        controller: 'MainCtrl',
		resolve: {
                     permission: function(AuthService, $location) {
						if(!AuthService.isAuthenticated()){
							$location.path('/logi');
						}
                     },
                 }
      }).
      when('/upload/:fileID', {
        templateUrl: 'resources/templates/uploadFileTemp.html',
        controller: 'UploadCtrl',
		resolve: {
                     permission: function(AuthService, $location) {
						if(!AuthService.isAuthenticated()){
							$location.path('/logi');
						}
                     },
                 }
      }).      
      otherwise({
        redirectTo: '/login'
      });
  });
  
  
  
      